<?xml version="1.0" encoding="UTF-8"?>    
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:c="http://java.sun.com/jstl/core"
      xmlns:a4j="http://richfaces.org/a4j"
      xmlns:rich="http://richfaces.org/rich"
      xmlns:util="http://java.sun.com/jsf/composite/components/util">
<ui:composition template="/WEB-INF/templates/platTemplate.xhtml">
	<ui:define name="content">
		<script type="text/javascript" src="${facesContext.externalContext.requestContextPath}/resources/javascript/dtree.js"/>
		<link type="text/css" rel="stylesheet" href="${facesContext.externalContext.requestContextPath}/resources/css/dtree.css"></link>				
		<h:form id="manageAuthorityRoleForm" prependId="false">
			<a4j:outputPanel id="toolbarPanel" ajaxRendered="true" layout="block" styleClass="toolbar">
				<div class="tdiv firstdiv">
					<a4j:commandLink action="#{manageAuthorityRolePage.preCreateAction}" value="" event="click" execute="@this" render="mainManageAuthorityRolePanel" styleClass="btns">
						<f:verbatim>
							<span class="btn_l">&nbsp;</span>
							<span class="btn_txt">#{message['operate.add.display']}</span>
							<span class="btn_r">&nbsp;</span>
						</f:verbatim>
					</a4j:commandLink>
				</div>
			</a4j:outputPanel>
			<div class="normalContent">
				<a4j:outputPanel id="searchPanel" layout="block">
						<div class="add_detail_box">
							<p>
								<span>
								<h:outputLabel value="#{message['role.name.display'] }" styleClass="normallabel"></h:outputLabel>
								<h:inputText value="#{manageAuthorityRolePage.page.param.name}" styleClass="normal_input_text"><f:ajax event="blur" execute="@this" render="@this"></f:ajax></h:inputText>
								</span>
							</p>
							
								<a4j:commandLink action="#{manageAuthorityRolePage.searchPageAction}" value="" event="click" execute="@this" render="searchPanel pageDataPanel mainManageAuthorityRolePanel" styleClass="btn"><f:verbatim><span>#{message['button.search.display'] }</span></f:verbatim></a4j:commandLink>

						</div>
				</a4j:outputPanel>
				<a4j:outputPanel id="pageDataPanel" layout="block">
					<div class="scrollDivGrid">
						<div class="scrollDivGridInner">
					    	<ul id="companyUlHeader" class="headline">
					    		<li class="percent15"><span>#{message['operate.display'] }</span></li>
							    <li class="percent10"><span>#{message['role.name.display'] }</span></li>
							    <li class="percent20"><span>#{message['role.remark.display'] }</span></li>
								<li class="percent20"><span>#{message['create.time.display'] }</span></li>
								<li class="percent20"><span>#{message['modify.time.display'] }</span></li>
				    			<li class="percent10 last"><span>#{message['sort.display'] }</span></li>
							</ul>
							<a4j:repeat value="#{manageAuthorityRolePage.page.page.result}" var="role" rowKeyVar="rowNo">
								<ul id="roleUl#{rowNo}" class="">
									<li class="percent15">
										<a4j:commandLink action="#{manageAuthorityRolePage.viewAction }" value="#{message['operate.view.display'] }" event="click" execute="@this" render="pageDataPanel mainManageAuthorityRolePanel"><f:param name="objId" value="#{role.id }"></f:param></a4j:commandLink>
										<f:verbatim>&nbsp;&nbsp;</f:verbatim>
										<a4j:commandLink action="#{manageAuthorityRolePage.editAction }" value="#{message['operate.edit.display'] }" event="click" execute="@this" render="pageDataPanel mainManageAuthorityRolePanel"><f:param name="objId" value="#{role.id }"></f:param></a4j:commandLink>
										<h:commandLink id="rrlink#{rowNo}" action="#{manageAuthorityRolePage.loadRoleResourceAction}" value="#{message['operate.allocate.resource.display'] }" >
											<f:param name="objId" value="#{role.id }"></f:param>
											<f:param name="name" value="#{role.name }"></f:param>
										</h:commandLink>
									</li>
									<li class="percent10"><h:outputLabel value="#{role.name} "></h:outputLabel></li>
								    <li class="percent20"><h:outputLabel value="#{role.remark }"></h:outputLabel></li>
								    <li class="percent20"><h:outputLabel value="#{role.createTime }"><f:convertDateTime timeZone="GMT+8" locale="#{localBean.locale}" pattern="yyyy-MM-dd HH:mm:ss"/></h:outputLabel></li>
								    <li class="percent20"><h:outputLabel value="#{role.modifyTime }"><f:convertDateTime timeZone="GMT+8" locale="#{localBean.locale}" pattern="yyyy-MM-dd HH:mm:ss"/></h:outputLabel></li>
								    <li class="percent10 last"><h:outputLabel value="#{role.sort }"></h:outputLabel></li>
							  	</ul>
						  	</a4j:repeat>
						  	<script language="javascript">
								setUlLastBorder('roleUlHeader');
							</script>
						  	<a4j:outputPanel id="emptyDataPanel" rendered="#{empty manageAuthorityRolePage.page.page.result}" display="block">
						  		<span class="f13 fB">#{msgs['empty.data.display'] }</span>
						  	</a4j:outputPanel>
						</div>
					</div>
					<div id="d_p_list">
						<util:pageNavigation id="systemUserNav" pageData="#{manageAuthorityRolePage.page.page }" pageNoAction="#{manageAuthorityRolePage.selectPageNo }" prePageNoId="prePageNoBtnFootHead" prePageNoLabel="#{message['page.navigation.pre.display']}" renderId="pageDataPanel" nextPageNoId="nextPageNoBtnFootHead" nextPageNoLabel="#{message['page.navigation.next.display']}"></util:pageNavigation>
					</div>
				</a4j:outputPanel>
	         	<a4j:outputPanel id="mainManageAuthorityRolePanel" ajaxRendered="true" layout="block">
					<h:panelGrid columns="2" styleClass="normaltable" headerClass="tleft" columnClasses="percent10 tleft,percent90" rendered="#{'VIEW' eq manageAuthorityRolePage.action }">
			
						<f:facet name="header">
							<h:outputLabel value="#{message['role.info.display'] }" styleClass="f14 fN"></h:outputLabel>
							[<a4j:commandLink action="#{manageAuthorityRolePage.viewToEditAction }" value="#{message['operate.edit.display'] }" event="click" execute="@this" render="mainManageAuthorityRolePanel"></a4j:commandLink>]
						</f:facet>
						
						<h:outputLabel value="#{message['role.name.display'] }：" styleClass="normallabel"></h:outputLabel>
						<h:outputText value="#{manageAuthorityRolePage.view.name }" styleClass="normal_output_text"></h:outputText>
						<h:outputLabel value="#{message['role.remark.display'] }：" styleClass="normallabel"></h:outputLabel>
						<h:outputText value="#{manageAuthorityRolePage.view.remark }" styleClass="normal_output_text"></h:outputText>
						<h:outputLabel value="#{message['create.time.display'] }：" styleClass="normallabel"></h:outputLabel>
						<h:outputText value="#{manageAuthorityRolePage.view.createTime }" styleClass="normal_output_text"><f:convertDateTime timeZone="GMT+8" locale="#{localBean.locale}" pattern="yyyy-MM-dd HH:mm:ss"/></h:outputText>
						<h:outputLabel value="#{message['modifytime.display'] }：" styleClass="normallabel"></h:outputLabel>
						<h:outputText value="#{manageAuthorityRolePage.view.modifyTime }" styleClass="normal_output_text"><f:convertDateTime timeZone="GMT+8" locale="#{localBean.locale}" pattern="yyyy-MM-dd HH:mm:ss"/></h:outputText>
						<h:outputLabel value="#{message['sort.display'] }：" styleClass="normallabel"></h:outputLabel>
						<h:outputText value="#{manageAuthorityRolePage.view.sort }" styleClass="normal_output_text"></h:outputText>
					</h:panelGrid>
					
					<h:panelGrid columns="2" styleClass="normaltable" headerClass="tleft" footerClass="tcenter" columnClasses="percent10 tleft,percent90" rendered="#{('EDIT' eq manageAuthorityRolePage.action) or ('NEW' eq manageAuthorityRolePage.action) }">
						
						<f:facet name="header">
							<h:outputLabel value="#{message['role.info.display'] }" styleClass="f14 fN"></h:outputLabel>
						</f:facet>
						
						<h:outputLabel value="#{message['role.name.display'] }：" styleClass="normallabel"></h:outputLabel>
						<h:inputText value="#{manageAuthorityRolePage.edit.name }" maxlength="100" styleClass="normal_input_text"><f:ajax event="blur" execute="@this" render="@this"></f:ajax></h:inputText>
						<h:outputLabel value="#{message['role.remark.display'] }：" styleClass="normallabel"></h:outputLabel>
						<h:inputText value="#{manageAuthorityRolePage.edit.remark }" maxlength="100" styleClass="normal_input_text"><f:ajax event="blur" execute="@this" render="@this"></f:ajax></h:inputText>
						<h:outputLabel value="#{message['sort.display'] }：" styleClass="normallabel"></h:outputLabel>
						<h:inputText value="#{manageAuthorityRolePage.edit.sort}" maxlength="10" styleClass="normal_input_text"><f:ajax event="blur" execute="@this" render="@this"></f:ajax></h:inputText>
						<h:outputLabel value=""></h:outputLabel>
						<h:panelGroup>
							<a4j:commandLink action="#{manageAuthorityRolePage.updateAction}" value="" event="click" execute="@this" oncomplete="javascript:refreshPageAction();" rendered="#{'EDIT' eq manageAuthorityRolePage.action }" styleClass="btn"><f:verbatim><span>#{message['button.update.display'] }</span></f:verbatim></a4j:commandLink>
							<a4j:commandLink action="#{manageAuthorityRolePage.saveAction}" value="" event="click" execute="@this" oncomplete="javascript:refreshPageAction();" rendered="#{'NEW' eq manageAuthorityRolePage.action }" styleClass="btn"><f:verbatim><span>#{message['button.save.display'] }</span></f:verbatim></a4j:commandLink>
						</h:panelGroup>
						<f:facet name="footer">
							<util:messages errorMessages="#{manageAuthorityRolePage.errorMessages}"></util:messages>
						</f:facet>
					</h:panelGrid>
					<a4j:jsFunction name="refreshPageAction" action="#{manageAuthorityRolePage.refreshPageAction }" render="mainManageAuthorityRolePanel pageDataPanel"></a4j:jsFunction>
				</a4j:outputPanel>
				<a4j:outputPanel id="roleResourcePanel" ajaxRendered="true" layout="block">
						<rich:panel rendered="#{'ALLOCATE' eq manageAuthorityRolePage.action }">
					        <f:facet name="header">
					            <h:outputLabel value="#{message['role.resource.allocate.display']}" styleClass="normallabel"/>
					        </f:facet>
				        
				        	
					        <h:outputLabel value="#{message['role.name.display'] }:#{manageAuthorityRolePage.currentRoleName}" styleClass="normallabel"></h:outputLabel>
					        <h:panelGroup>
					        	<h:outputText value="#{manageAuthorityRolePage.resTree.treeResource}" escape="false"></h:outputText>
							</h:panelGroup>
	                     	<h:panelGroup>
	                     		<a4j:commandLink value="" event="click" execute="@form" onclick="allocateRoleResourceClick();" render="mainManageAuthorityRolePanel roleResourcePanel" styleClass="btn"><f:verbatim><span>#{message['button.save.display'] }</span></f:verbatim></a4j:commandLink>
	                     	</h:panelGroup>
	                     	<script type="text/javascript">
								function allocateRoleResourceClick() {
									var str=""; 
						            $("input[name='resource']").each(function(){ 
						                  if(this.checked) str+=$(this).val()+",";             
						            })
						            allocateRoleResource(str);
						        }
						    </script>
						    <a4j:jsFunction name="allocateRoleResource" action="#{manageAuthorityRolePage.allocateRoleResourceAction }">
						    	<f:param name="resourceStr"></f:param>
						    </a4j:jsFunction>
                     	</rich:panel>
				    
			    </a4j:outputPanel>
			</div>
         </h:form>
         <div style="clear:both;float:none" />
	</ui:define>
</ui:composition>
</html>

